
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class DmsPreDeployMachineServiceImpl implements DmsPreDeployMachineService  {

    @Resource
    private DmsPreDeployMachineMapper dmsPreDeployMachineMapper;

    /**
     * 获取 DmsPreDeployMachine 分页列表
     */
    @Transactional
    public IPage getDmsPreDeployMachinePagination( PaginationVo paginationVo, DmsPreDeployMachineQuery dmsPreDeployMachineQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<DmsPreDeployMachineEntity> lqs = new LambdaQueryWrapper();
        dmsPreDeployMachineMapper.selectPage(page, lqs);

        List<DmsPreDeployMachineEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 DmsPreDeployMachine 所有数据
     *
    */
    @Transactional
    public List<DmsPreDeployMachineEntity> getDmsPreDeployMachineAllList( DmsPreDeployMachineQuery dmsPreDeployMachineQuery ) throws Exception {

        LambdaQueryWrapper<DmsPreDeployMachineEntity> lqs = new LambdaQueryWrapper();
        List<DmsPreDeployMachineEntity> list = dmsPreDeployMachineMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 DmsPreDeployMachine 详情
    */
    @Transactional
    public DmsPreDeployMachineEntity getDmsPreDeployMachineDetail( Long id) throws Exception {

        DmsPreDeployMachineEntity dmsPreDeployMachine = dmsPreDeployMachineMapper.selectById(id);
        return dmsPreDeployMachine;
    }


    /**
     * 新增 DmsPreDeployMachine
     * */
    @Transactional
    public void addDmsPreDeployMachine(DmsPreDeployMachineVo dmsPreDeployMachineVo) throws Exception {

        DmsPreDeployMachineEntity dmsPreDeployMachine = new DmsPreDeployMachineEntity();
        ReflectionCopy.copyProperties( dmsPreDeployMachine, dmsPreDeployMachineVo );
        dmsPreDeployMachineMapper.insert(dmsPreDeployMachine);
        return;
    }


    /**
     * 更新 DmsPreDeployMachine
     * */
    @Transactional
    public void updateDmsPreDeployMachine( DmsPreDeployMachineVo dmsPreDeployMachineVo) throws Exception {

        if( dmsPreDeployMachineVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        DmsPreDeployMachineEntity dmsPreDeployMachine = new DmsPreDeployMachineEntity();
        ReflectionCopy.copyProperties( dmsPreDeployMachine, dmsPreDeployMachineVo );
        dmsPreDeployMachineMapper.updateById(dmsPreDeployMachine);
        return;
    }

    /**
     * 删除 DmsPreDeployMachine
     * */
    @Transactional
    public void batchRemoveDmsPreDeployMachine( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        dmsPreDeployMachineMapper.deleteBatchIds(ids);
    }

}

      